home *** CD-ROM | disk | FTP | other *** search
/ Chip: 25 Years Anniversary / CHIP_25Jahre_Jubilaeum.iso / G DATA AddOns2 / WebShop / _SETUP.1 / sb2buyitem.js < prev    next >
Text File  |  2001-12-03  |  4KB  |  76 lines

  1. <!-- sb2buyitem Buy item and clear basket -->
  2. <!-- (c) Copyright 2001 GS Software       -->
  3. <!--                                      -->
  4. <SCRIPT LANGUAGE="JavaScript">
  5. {tagsoff}
  6.  
  7. function buyItem(newItem, newPrice, newQuantity , price1, price2, qty1, qty2 , textin, Attribut1, Attribut2, Attribut3, productvatrate)
  8. {
  9.  newItem = unescape(newItem);
  10.         var index=-1;
  11.         if (! Attribut1) {Attribut1=""};
  12.         if (! Attribut2) {Attribut2=""};
  13.         if (! Attribut3) {Attribut3=""};
  14.         if (! price1)    {price1="0"};
  15.         if (! price2)    {price2="0"};
  16.         if (! qty1)      {qty1="0"};
  17.         if (! qty2)      {qty2="0"};
  18.         if (! textin)    {textin=""};
  19.  
  20.  
  21. {tagson}
  22.         if (!( (parseFloat(newQuantity) == parseInt(newQuantity) )&&( parseInt(newQuantity) > 0) ) || isNaN(newQuantity))
  23.                 alert(Loc_Integer);
  24.         else
  25.         {
  26.                 if(Attribut1.substr(Attribut1.length-1,1)=='?')
  27.                         alert(Loc_Please+ Attribut1.substr(0,Attribut1.length-1)+Loc_Select);
  28.                 else
  29.                 {
  30.                         if(Attribut2.substr(Attribut2.length-1,1)=='?')
  31.                                 alert(Loc_Please+ Attribut2.substr(0,Attribut2.length-1)+Loc_Select);
  32.                         else
  33.                         {
  34.                                 if(Attribut3.substr(Attribut3.length-1,1)=='?')
  35.                                         alert(Loc_Please+ Attribut3.substr(0,Attribut3.length-1)+Loc_Select);
  36.                                 else
  37.                                 {
  38.                                         if(confirm(newQuantity+' x '+newItem+'{ORDERDIALOGTEXT}'))
  39.                                         {
  40.                                                 for (var i=1; i<= theBasket.length-1; i++)
  41.                                                 {
  42.                                                         if ((theBasket[i].Item==newItem)&&(theBasket[i].Attribut1==Attribut1)&&(theBasket[i].Attribut2==Attribut2)&&(theBasket[i].Attribut3==Attribut3))
  43.                                                         {
  44.                                                                 if (window.confirm(Loc_Add))
  45.                                                                         theBasket[i].Quantity=parseInt(theBasket[i].Quantity)+parseInt(newQuantity);
  46.                                                                 else
  47.                                                                         theBasket[i].Quantity=newQuantity
  48.  
  49.                                                                 theBasket[i].Textin=textin;
  50.                                                                 index=i;
  51.                                                         }
  52.                                                 }
  53.  
  54.                                                 if (index<0)
  55.                                                 {
  56.                                                         var neuItem=new BasketItem(newItem,newPrice,price1,price2,qty1,qty2,newQuantity,textin, Attribut1, Attribut2, Attribut3, productvatrate);
  57. //                                                        var neuItem=new BasketItem(newItem,newPrice,price1,price2,qty1,qty2,newQuantity,textin, Attribut1, Attribut2, Attribut3);
  58.                                                         theBasket=theBasket.concat([neuItem]);
  59.                                                 }
  60.                                         }
  61.                             basketframe.location = "permbasket.htm";
  62.                                 }
  63.                         }
  64.                 }
  65.         }
  66. }
  67.  
  68.  
  69. function resetShoppingBasket()
  70. {
  71.         theBasket=theBasket.slice(0,1);
  72. }
  73.  
  74. {tagson}
  75.  
  76. </SCRIPT>